﻿namespace Borg.AddOn
{
    internal sealed class NotifierNotificationHookChain : INotifierNotificationHook
    {
        private readonly INotifierNotificationHook[] _hooks;

        public NotifierNotificationHookChain(INotifierNotificationHook[] hooks)
        {
            _hooks = hooks;
        }

        public void OnActivated(ExtensionEventArgs args)
        {
            foreach (INotifierNotificationHook hook in _hooks)
                hook.OnActivated(args);
        }

        public void OnClosed(SlotEventArgs args)
        {
            foreach (INotifierNotificationHook hook in _hooks)
                hook.OnClosed(args);
        }

        public void OnContractAdded(ContractEventArgs args)
        {
            foreach (INotifierNotificationHook hook in _hooks)
                hook.OnContractAdded(args);
        }

        public void OnContractRemoved(ContractEventArgs args)
        {
            foreach (INotifierNotificationHook hook in _hooks)
                hook.OnContractRemoved(args);
        }

        public void OnCreated(ExtensionEventArgs args)
        {
            foreach (INotifierNotificationHook hook in _hooks)
                hook.OnCreated(args);
        }

        public void OnDeactivated(ExtensionEventArgs args)
        {
            foreach (INotifierNotificationHook hook in _hooks)
                hook.OnDeactivated(args);
        }

        public void OnDestroyed(ExtensionEventArgs args)
        {
            foreach (INotifierNotificationHook hook in _hooks)
                hook.OnDestroyed(args);
        }

        public void OnHandlerAdded(object handler)
        {
            foreach (INotifierNotificationHook hook in _hooks)
                hook.OnHandlerAdded(handler);
        }

        public void OnHandlerInvocationFinished(object handler)
        {
            foreach (INotifierNotificationHook hook in _hooks)
                hook.OnHandlerInvocationFinished(handler);
        }

        public void OnHandlerInvocationStarted(object handler)
        {
            foreach (INotifierNotificationHook hook in _hooks)
                hook.OnHandlerInvocationStarted(handler);
        }

        public void OnHandlerRemoved(object handler)
        {
            foreach (INotifierNotificationHook hook in _hooks)
                hook.OnHandlerRemoved(handler);
        }

        public void OnOpened(SlotEventArgs args)
        {
            foreach (INotifierNotificationHook hook in _hooks)
                hook.OnOpened(args);
        }

        public void OnPlugged(CompositionEventArgs args)
        {
            foreach (INotifierNotificationHook hook in _hooks)
                hook.OnPlugged(args);
        }

        public void OnPluginAdded(PluginEventArgs args)
        {
            foreach (INotifierNotificationHook hook in _hooks)
                hook.OnPluginAdded(args);
        }

        public void OnPluginRemoved(PluginEventArgs args)
        {
            foreach (INotifierNotificationHook hook in _hooks)
                hook.OnPluginRemoved(args);
        }

        public void OnTagged(TagEventArgs args)
        {
            foreach (INotifierNotificationHook hook in _hooks)
                hook.OnTagged(args);
        }

        public void OnUnplugged(CompositionEventArgs args)
        {
            foreach (INotifierNotificationHook hook in _hooks)
                hook.OnUnplugged(args);
        }

        public void OnUntagged(TagEventArgs args)
        {
            foreach (INotifierNotificationHook hook in _hooks)
                hook.OnUntagged(args);
        }
    }
}
